home *** CD-ROM | disk | FTP | other *** search
PiXCL source | 1996-07-11 | 5.4 KB | 217 lines |
- Initialize:
- WinGetActive(Win$)
- UseCoordinates(PIXEL)
- UseBackGround(TRANSPARENT,192,192,192)
- DrawBackGround
- WaitInput(100) {let NT and 95 catch up}
- InfoMenu(REMOVE)
- SetMenu()
- WinLocate(Win$,250,10,620,240,Res)
- Title$ = "Windows Registry Commands"
- WinTitle(Win$, Title$)
- WinShow(Title$,NOTOPMOST,Res)
- DirGet(SourceDir$)
-
-
- SetMenu("E&xit!",Leave,
- ENDPOPUP,
- "&Registry",IGNORE,
- "&Open PiXCL4.0 Key",Open_Key,
- "&Enum PiXCL4.0 Key",Enum_Key,
- "&Close PiXCL4.0 Key",Close_Key,
- SEPARATOR,
- "&Add PiXCL4.0 Key",Create_Key,
- "&Delete PiXCL4.0 Key",Delete_Key,
- SEPARATOR,
- "&Query PiXCL4.0 Key",QueryKey,
- "&Query PiXCL4.0 Key Value",QueryValue,
- ENDPOPUP,
- "&Help",IGNORE,
- "&Information",Info,
- "&View PXL source",ViewSource,
- SEPARATOR,
- "&About",About,
- ENDPOPUP)
-
- Wait_for_Input:
- WaitInput()
-
-
- Leave:
- End
-
-
- Info:
- MessageBox(OK,1,INFORMATION,
- "This sample program shows you how to access the Registry.
- We suggest that you look at the PiXCL code first to see
- what is displayed as results in the client area. There are
- also comments in the PXL source that explain more fully
- what is happening.
-
- To use this sample program, you must first create some
- entries in the Registry with the 'Create' menu item. Once
- entries are created, start up Windows REGEDIT and look in
- the HKEY_CLASSES_ROOT for the 'PiXCL4.0' entries.
-
- The 'Open' menu item will now return success. Try the
- 'Query' menu item and see that the information returned
- is the same as you see with REGEDIT.
-
- Please TAKE CARE accessing the Registry: trial and error
- changes can result in a corrupted database, and a reload
- of all software may be necessary.",
- "Using the Registry Access Sample program",Res)
-
- Goto Wait_for_Input
-
-
- ViewSource:
- PXLfile$ = SourceDir$ + "\registry.pxl"
- CmdLine$ = "Notepad " + PXLfile$
- Run(CmdLine$)
- Goto Wait_for_Input
-
-
- About:
- AboutUser("PiXCL 4.0 Sample Program",
- "Reading and Writing the Windows Registration Database.",
- "This sample program will create, read and delete
- specific sample entries for PiXCL 4.0 in the Registry.
- No existing entries are accessed or changed.")
- Goto Wait_for_Input
-
- Open_Key:
- DrawBackground
- RDBOpenKey(@RDB_CLASSES_ROOT,"PiXCL4.0",Handle)
- DrawNumber(10,10,Handle)
-
- Goto Wait_for_Input
-
- QueryKey:
- DrawBackground
- RDBQueryKey(Handle,Class$, NumKeys, NumValues, Res)
- If Class$ = "" Then Class$ = "Class$ returns NULL"
- DrawText(10,10,Class$)
- DrawNumber(10,30,NumKeys)
- DrawNumber(10,50,NumValues)
-
- Goto Wait_for_Input
-
-
- QueryValue:
- DrawBackground
- RDBOpenKey(Handle,"DefaultIcon",IconHandle)
- RDBOpenKey(Handle,"Image Formats",FMTHandle)
- RDBOpenKey(Handle,"Properties",PtyHandle)
-
- RDBQueryValue(IconHandle,"",Value1$,Res) {gets "(Default)" value string}
- RDBQueryValue(IconHandle,"SecondIcon",Value2$,Res) {gets specific value string}
- RDBQueryValue(FMTHandle,"Type2",Value3$,Res) {gets specific value}
-
- RDBQueryValue(PtyHandle,"Type1",Value4$,Res) {gets specific value}
-
- DrawText(10,10,Value1$)
- DrawText(10,35,Value2$)
- DrawText(10,60,Value3$)
- DrawText(10,85,Value4$)
- Goto Wait_for_Input
-
-
- Close_Key:
- DrawBackground
- RDBCloseKey(Handle,Res)
- DrawNumber(10,10,Res)
-
- Goto Wait_for_Input
-
-
- Create_Key:
- DrawBackground
- RDBCreateKey(@RDB_CLASSES_ROOT,"PiXCL4.0","",Handle,Res)
- RDBCreateKey(Handle,"DefaultIcon","",PXL40IconHandle,Res)
-
- {In next, note NULL string, Handle defines location. This will add the
- value string to the "(Default)" Handle entry in the registry}
-
- RDBSetValue(PXL40IconHandle,"", "h:\p40tools\pdk\PiXCL.exe,1",STRING,Res)
-
- RDBSetValue(PXL40IconHandle,"SecondIcon", {note new item in "DefaultIcon" tree}
- "h:\p40tools\pdk\PiXCL.exe,2",STRING,Res)
-
- RDBCreateKey(Handle,"Properties","",PXLPropHandle,Res)
- RDBSetValue(PXLPropHandle,"Type1","256",DWORD,Res)
-
- RDBCreateKey(Handle,"Image Formats","",PXLImgHandle,Res)
- RDBSetValue(PXLImgHandle,"Type2","BMP|RLE|PNG|JPG|",LIST,Res)
-
-
-
- If Res <= 1
- DrawNumber(10,10,Handle)
- DrawNumber(10,35,Res)
- Else
- DrawText(10,10,"Entry already exists")
- DrawNumber(10,35,Handle)
- Endif
-
- Goto Wait_for_Input
-
- Delete_Key:
- DrawBackground
- RDBDeleteKey(@RDB_CLASSES_ROOT,"PiXCL4.0",Res)
- {RDBDeleteKey(Handle,"PiXCL4.0",Res)} {fails, key$ is not subkey of handle}
- DrawNumber(10,10,Res)
-
-
- Goto Wait_for_Input
-
- Enum_Key:
- DrawBackground
- Index = 0
- RDBEnumKey(Handle,0,SubKey$,Class$,Res)
- DrawText(10,10,SubKey$)
- If Class$ = "" Then Class$ = "Class$ returns NULL"
- DrawText(10,30,Class$)
-
- RDBEnumKey(Handle,1,SubKey$,Class$,Res)
- DrawText(10,50,SubKey$)
- If Class$ = "" Then Class$ = "Class$ returns NULL"
- DrawText(10,70,Class$)
-
- RDBEnumKey(Handle,2,SubKey$,Class$,Res)
- DrawText(10,90,SubKey$)
- If Class$ = "" Then Class$ = "Class$ returns NULL"
- DrawText(10,110,Class$)
-
- {This should result in a "no more entries" Result=2}
- RDBEnumKey(Handle,3,SubKey$,Class$,Res)
- DrawNumber(230,150,Res)
- If SubKey$ = "" Then SubKey$ = "SubKey$ returns NULL"
- DrawText(25,130,SubKey$)
- If Class$ = "" Then Class$ = "Class$ returns NULL"
- DrawText(25,150,Class$)
-
-
-
- Goto Wait_for_Input
-
- EnumLoop:
- RDBEnumKey(Handle,Index,SubKey$,Class$,Res)
- DrawBackGround WaitInput(400)
- DrawNumber(10,0,Res)
- DrawText(10,20,SubKey$)
- DrawText(10,40,Class$)
- Index = Index + 1
- If Res <> 2 Then Goto EnumLoop
-
-
- Goto Wait_for_Input
-
-
-
-
-
-
-
-